package com.wjw.single.single02;

/**
 * 单一职责原则
 *
 * @author ikaros
 * @date 2024/7/7 0:35
 * @see <a href="ikaros@qq.com">mailTo: ikaros@qq.com</a>
 */
public class SingleResponsibility {

    public static void main(String[] args) {
        LandVehicle landVehicle = new LandVehicle();
        landVehicle.run("自行车");
        MaritimeVehicle maritimeVehicle = new MaritimeVehicle();
        maritimeVehicle.run("游轮");
        AirVehicle airVehicle = new AirVehicle();
        airVehicle.run("客机");
    }
}

/**
 * 交通工具类
 */
class LandVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在公路上行驶");
    }
}

class MaritimeVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在海中游行");
    }
}

class AirVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在天上飞行");
    }
}